package com.android.views;

import android.app.Activity;
import android.media.AudioManager;
import android.os.Bundle;
import com.android.global.Consts;
import com.android.presenters.PreviewPresenter;

public class PreviewActivity extends Activity implements IFocusable {

	PreviewPresenter presenter;
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
		// Setting up basic activity requirements
		setVolumeControlStream(AudioManager.STREAM_MUSIC);
		
		// Creating the presenter for this view
		presenter = new PreviewPresenter(this);

		// Get selected workout name from intent
		String workoutName = getIntent().getExtras().getString(
				Consts.SELECT_WORKOUT_TAG);

		// Load workout if exists, else making a new workout
		if (workoutName == null) {
			CreateNewWorkout();
		} else {
			LoadWorkout(workoutName);
		}
	}

	@Override
	public void GetFocus() {
		// TODO Complete

	}

	private void SetFocus() {
		// TODO Complete

	}
	
	private void CreateNewWorkout() {
		
		presenter.CreateNewWorkout();
		// TODO Complete - load data to the screen
	}

	private void LoadWorkout(String workoutName) {
		
		presenter.LoadWorkoutData(workoutName);
		// TODO Complete - load data to the screen
	}
}
